Integrand size = 14, antiderivative size = 124 \[ \int x \cos \left (a+b x-c x^2\right ) \, dx=-\frac {b \sqrt {\frac {\pi }{2}} \cos \left (a+\frac {b^2}{4 c}\right ) \operatorname {FresnelC}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {2 \pi }}\right )}{2 c^{3/2}}-\frac {b \sqrt {\frac {\pi }{2}} \operatorname {FresnelS}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {2 \pi }}\right ) \sin \left (a+\frac {b^2}{4 c}\right )}{2 c^{3/2}}-\frac {\sin \left (a+b x-c x^2\right )}{2 c} \]
-1/2*sin(-c*x^2+b*x+a)/c-1/4*b*cos(a+1/4*b^2/c)*FresnelC(1/2*(-2*c*x+b)/c^ (1/2)*2^(1/2)/Pi^(1/2))*2^(1/2)*Pi^(1/2)/c^(3/2)-1/4*b*FresnelS(1/2*(-2*c* x+b)/c^(1/2)*2^(1/2)/Pi^(1/2))*sin(a+1/4*b^2/c)*2^(1/2)*Pi^(1/2)/c^(3/2)
Time = 0.21 (sec) , antiderivative size = 116, normalized size of antiderivative = 0.94 \[ \int x \cos \left (a+b x-c x^2\right ) \, dx=\frac {b \sqrt {2 \pi } \cos \left (a+\frac {b^2}{4 c}\right ) \operatorname {FresnelC}\left (\frac {-b+2 c x}{\sqrt {c} \sqrt {2 \pi }}\right )+b \sqrt {2 \pi } \operatorname {FresnelS}\left (\frac {-b+2 c x}{\sqrt {c} \sqrt {2 \pi }}\right ) \sin \left (a+\frac {b^2}{4 c}\right )-2 \sqrt {c} \sin (a+x (b-c x))}{4 c^{3/2}} \]
(b*Sqrt[2*Pi]*Cos[a + b^2/(4*c)]*FresnelC[(-b + 2*c*x)/(Sqrt[c]*Sqrt[2*Pi] )] + b*Sqrt[2*Pi]*FresnelS[(-b + 2*c*x)/(Sqrt[c]*Sqrt[2*Pi])]*Sin[a + b^2/ (4*c)] - 2*Sqrt[c]*Sin[a + x*(b - c*x)])/(4*c^(3/2))
Time = 0.36 (sec) , antiderivative size = 127, normalized size of antiderivative = 1.02, number of steps used = 5, number of rules used = 5, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.357, Rules used = {3943, 3929, 25, 3832, 3833}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int x \cos \left (a+b x-c x^2\right ) \, dx\) |
\(\Big \downarrow \) 3943 |
\(\displaystyle \frac {b \int \cos \left (-c x^2+b x+a\right )dx}{2 c}-\frac {\sin \left (a+b x-c x^2\right )}{2 c}\) |
\(\Big \downarrow \) 3929 |
\(\displaystyle \frac {b \left (\cos \left (a+\frac {b^2}{4 c}\right ) \int \cos \left (\frac {(b-2 c x)^2}{4 c}\right )dx-\sin \left (a+\frac {b^2}{4 c}\right ) \int -\sin \left (\frac {(b-2 c x)^2}{4 c}\right )dx\right )}{2 c}-\frac {\sin \left (a+b x-c x^2\right )}{2 c}\) |
\(\Big \downarrow \) 25 |
\(\displaystyle \frac {b \left (\sin \left (a+\frac {b^2}{4 c}\right ) \int \sin \left (\frac {(b-2 c x)^2}{4 c}\right )dx+\cos \left (a+\frac {b^2}{4 c}\right ) \int \cos \left (\frac {(b-2 c x)^2}{4 c}\right )dx\right )}{2 c}-\frac {\sin \left (a+b x-c x^2\right )}{2 c}\) |
\(\Big \downarrow \) 3832 |
\(\displaystyle \frac {b \left (\cos \left (a+\frac {b^2}{4 c}\right ) \int \cos \left (\frac {(b-2 c x)^2}{4 c}\right )dx-\frac {\sqrt {\frac {\pi }{2}} \sin \left (a+\frac {b^2}{4 c}\right ) \operatorname {FresnelS}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {2 \pi }}\right )}{\sqrt {c}}\right )}{2 c}-\frac {\sin \left (a+b x-c x^2\right )}{2 c}\) |
\(\Big \downarrow \) 3833 |
\(\displaystyle \frac {b \left (-\frac {\sqrt {\frac {\pi }{2}} \cos \left (a+\frac {b^2}{4 c}\right ) \operatorname {FresnelC}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {2 \pi }}\right )}{\sqrt {c}}-\frac {\sqrt {\frac {\pi }{2}} \sin \left (a+\frac {b^2}{4 c}\right ) \operatorname {FresnelS}\left (\frac {b-2 c x}{\sqrt {c} \sqrt {2 \pi }}\right )}{\sqrt {c}}\right )}{2 c}-\frac {\sin \left (a+b x-c x^2\right )}{2 c}\) |
(b*(-((Sqrt[Pi/2]*Cos[a + b^2/(4*c)]*FresnelC[(b - 2*c*x)/(Sqrt[c]*Sqrt[2* Pi])])/Sqrt[c]) - (Sqrt[Pi/2]*FresnelS[(b - 2*c*x)/(Sqrt[c]*Sqrt[2*Pi])]*S in[a + b^2/(4*c)])/Sqrt[c]))/(2*c) - Sin[a + b*x - c*x^2]/(2*c)
3.1.7.3.1 Defintions of rubi rules used
Int[Sin[(d_.)*((e_.) + (f_.)*(x_))^2], x_Symbol] :> Simp[(Sqrt[Pi/2]/(f*Rt[ d, 2]))*FresnelS[Sqrt[2/Pi]*Rt[d, 2]*(e + f*x)], x] /; FreeQ[{d, e, f}, x]
Int[Cos[(d_.)*((e_.) + (f_.)*(x_))^2], x_Symbol] :> Simp[(Sqrt[Pi/2]/(f*Rt[ d, 2]))*FresnelC[Sqrt[2/Pi]*Rt[d, 2]*(e + f*x)], x] /; FreeQ[{d, e, f}, x]
Int[Cos[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2], x_Symbol] :> Simp[Cos[(b^2 - 4* a*c)/(4*c)] Int[Cos[(b + 2*c*x)^2/(4*c)], x], x] + Simp[Sin[(b^2 - 4*a*c) /(4*c)] Int[Sin[(b + 2*c*x)^2/(4*c)], x], x] /; FreeQ[{a, b, c}, x] && Ne Q[b^2 - 4*a*c, 0]
Int[Cos[(a_.) + (b_.)*(x_) + (c_.)*(x_)^2]*((d_.) + (e_.)*(x_)), x_Symbol] :> Simp[e*(Sin[a + b*x + c*x^2]/(2*c)), x] + Simp[(2*c*d - b*e)/(2*c) Int [Cos[a + b*x + c*x^2], x], x] /; FreeQ[{a, b, c, d, e}, x] && NeQ[2*c*d - b *e, 0]
Time = 0.86 (sec) , antiderivative size = 110, normalized size of antiderivative = 0.89
method | result | size |
default | \(-\frac {\sin \left (-c \,x^{2}+b x +a \right )}{2 c}+\frac {b \sqrt {2}\, \sqrt {\pi }\, \left (\cos \left (\frac {\frac {b^{2}}{4}+a c}{c}\right ) \operatorname {C}\left (\frac {\sqrt {2}\, \left (-c x +\frac {b}{2}\right )}{\sqrt {\pi }\, \sqrt {-c}}\right )-\sin \left (\frac {\frac {b^{2}}{4}+a c}{c}\right ) \operatorname {S}\left (\frac {\sqrt {2}\, \left (-c x +\frac {b}{2}\right )}{\sqrt {\pi }\, \sqrt {-c}}\right )\right )}{4 c \sqrt {-c}}\) | \(110\) |
risch | \(\frac {b \sqrt {\pi }\, {\mathrm e}^{-\frac {i \left (4 a c +b^{2}\right )}{4 c}} \operatorname {erf}\left (\sqrt {-i c}\, x +\frac {i b}{2 \sqrt {-i c}}\right )}{8 c \sqrt {-i c}}-\frac {b \sqrt {\pi }\, {\mathrm e}^{\frac {i \left (4 a c +b^{2}\right )}{4 c}} \operatorname {erf}\left (-\sqrt {i c}\, x +\frac {i b}{2 \sqrt {i c}}\right )}{8 c \sqrt {i c}}-\frac {\sin \left (-c \,x^{2}+b x +a \right )}{2 c}\) | \(120\) |
parts | \(\frac {\sqrt {2}\, \sqrt {\pi }\, x \cos \left (\frac {\frac {b^{2}}{4}+a c}{c}\right ) \operatorname {C}\left (\frac {\sqrt {2}\, \left (-c x +\frac {b}{2}\right )}{\sqrt {\pi }\, \sqrt {-c}}\right )}{2 \sqrt {-c}}-\frac {\sqrt {2}\, \sqrt {\pi }\, x \sin \left (\frac {\frac {b^{2}}{4}+a c}{c}\right ) \operatorname {S}\left (\frac {\sqrt {2}\, \left (-c x +\frac {b}{2}\right )}{\sqrt {\pi }\, \sqrt {-c}}\right )}{2 \sqrt {-c}}-\frac {\sqrt {2}\, \sqrt {\pi }\, \left (-\frac {\cos \left (\frac {\frac {b^{2}}{4}+a c}{c}\right ) \sqrt {2}\, \sqrt {\pi }\, \sqrt {-c}\, \left (\operatorname {C}\left (-\frac {\sqrt {2}\, c x}{\sqrt {\pi }\, \sqrt {-c}}+\frac {\sqrt {2}\, b}{2 \sqrt {\pi }\, \sqrt {-c}}\right ) \left (-\frac {\sqrt {2}\, c x}{\sqrt {\pi }\, \sqrt {-c}}+\frac {\sqrt {2}\, b}{2 \sqrt {\pi }\, \sqrt {-c}}\right )-\frac {\sin \left (\frac {\pi \left (-\frac {\sqrt {2}\, c x}{\sqrt {\pi }\, \sqrt {-c}}+\frac {\sqrt {2}\, b}{2 \sqrt {\pi }\, \sqrt {-c}}\right )^{2}}{2}\right )}{\pi }\right )}{2 c}+\frac {\sin \left (\frac {\frac {b^{2}}{4}+a c}{c}\right ) \sqrt {2}\, \sqrt {\pi }\, \sqrt {-c}\, \left (\operatorname {S}\left (-\frac {\sqrt {2}\, c x}{\sqrt {\pi }\, \sqrt {-c}}+\frac {\sqrt {2}\, b}{2 \sqrt {\pi }\, \sqrt {-c}}\right ) \left (-\frac {\sqrt {2}\, c x}{\sqrt {\pi }\, \sqrt {-c}}+\frac {\sqrt {2}\, b}{2 \sqrt {\pi }\, \sqrt {-c}}\right )+\frac {\cos \left (\frac {\pi \left (-\frac {\sqrt {2}\, c x}{\sqrt {\pi }\, \sqrt {-c}}+\frac {\sqrt {2}\, b}{2 \sqrt {\pi }\, \sqrt {-c}}\right )^{2}}{2}\right )}{\pi }\right )}{2 c}\right )}{2 \sqrt {-c}}\) | \(381\) |
-1/2*sin(-c*x^2+b*x+a)/c+1/4*b/c*2^(1/2)*Pi^(1/2)/(-c)^(1/2)*(cos((1/4*b^2 +a*c)/c)*FresnelC(2^(1/2)/Pi^(1/2)/(-c)^(1/2)*(-c*x+1/2*b))-sin((1/4*b^2+a *c)/c)*FresnelS(2^(1/2)/Pi^(1/2)/(-c)^(1/2)*(-c*x+1/2*b)))
Time = 0.29 (sec) , antiderivative size = 125, normalized size of antiderivative = 1.01 \[ \int x \cos \left (a+b x-c x^2\right ) \, dx=\frac {\sqrt {2} \pi b \sqrt {\frac {c}{\pi }} \cos \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right ) \operatorname {C}\left (\frac {\sqrt {2} {\left (2 \, c x - b\right )} \sqrt {\frac {c}{\pi }}}{2 \, c}\right ) + \sqrt {2} \pi b \sqrt {\frac {c}{\pi }} \operatorname {S}\left (\frac {\sqrt {2} {\left (2 \, c x - b\right )} \sqrt {\frac {c}{\pi }}}{2 \, c}\right ) \sin \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right ) + 2 \, c \sin \left (c x^{2} - b x - a\right )}{4 \, c^{2}} \]
1/4*(sqrt(2)*pi*b*sqrt(c/pi)*cos(1/4*(b^2 + 4*a*c)/c)*fresnel_cos(1/2*sqrt (2)*(2*c*x - b)*sqrt(c/pi)/c) + sqrt(2)*pi*b*sqrt(c/pi)*fresnel_sin(1/2*sq rt(2)*(2*c*x - b)*sqrt(c/pi)/c)*sin(1/4*(b^2 + 4*a*c)/c) + 2*c*sin(c*x^2 - b*x - a))/c^2
\[ \int x \cos \left (a+b x-c x^2\right ) \, dx=\int x \cos {\left (a + b x - c x^{2} \right )}\, dx \]
Result contains complex when optimal does not.
Time = 0.62 (sec) , antiderivative size = 580, normalized size of antiderivative = 4.68 \[ \int x \cos \left (a+b x-c x^2\right ) \, dx=-\frac {{\left (-\left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} + \left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b^{2} \cos \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right ) + {\left (\left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} - \left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b^{2} \sin \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right ) - 2 \, {\left ({\left (-\left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} + \left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b c \cos \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right ) + {\left (\left (i + 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )} - \left (i - 1\right ) \, \sqrt {2} \sqrt {\pi } {\left (\operatorname {erf}\left (\frac {1}{2} \, \sqrt {-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{c}}\right ) - 1\right )}\right )} b c \sin \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right )\right )} x - 4 \, {\left (c {\left (-i \, e^{\left (\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{4 \, c}\right )} + i \, e^{\left (-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{4 \, c}\right )}\right )} \cos \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right ) - c {\left (e^{\left (\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{4 \, c}\right )} + e^{\left (-\frac {4 i \, c^{2} x^{2} - 4 i \, b c x + i \, b^{2}}{4 \, c}\right )}\right )} \sin \left (\frac {b^{2} + 4 \, a c}{4 \, c}\right )\right )} \sqrt {\frac {4 \, c^{2} x^{2} - 4 \, b c x + b^{2}}{c}}}{16 \, c^{2} \sqrt {\frac {4 \, c^{2} x^{2} - 4 \, b c x + b^{2}}{c}}} \]
-1/16*((-(I - 1)*sqrt(2)*sqrt(pi)*(erf(1/2*sqrt((4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1) + (I + 1)*sqrt(2)*sqrt(pi)*(erf(1/2*sqrt(-(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1))*b^2*cos(1/4*(b^2 + 4*a*c)/c) + ((I + 1)*sqrt( 2)*sqrt(pi)*(erf(1/2*sqrt((4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1) - (I - 1)*sqrt(2)*sqrt(pi)*(erf(1/2*sqrt(-(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1))*b^2*sin(1/4*(b^2 + 4*a*c)/c) - 2*((-(I - 1)*sqrt(2)*sqrt(pi)*(erf(1 /2*sqrt((4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1) + (I + 1)*sqrt(2)*sqrt( pi)*(erf(1/2*sqrt(-(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1))*b*c*cos(1/4 *(b^2 + 4*a*c)/c) + ((I + 1)*sqrt(2)*sqrt(pi)*(erf(1/2*sqrt((4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1) - (I - 1)*sqrt(2)*sqrt(pi)*(erf(1/2*sqrt(-(4* I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c)) - 1))*b*c*sin(1/4*(b^2 + 4*a*c)/c))*x - 4*(c*(-I*e^(1/4*(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/c) + I*e^(-1/4*(4*I*c^2 *x^2 - 4*I*b*c*x + I*b^2)/c))*cos(1/4*(b^2 + 4*a*c)/c) - c*(e^(1/4*(4*I*c^ 2*x^2 - 4*I*b*c*x + I*b^2)/c) + e^(-1/4*(4*I*c^2*x^2 - 4*I*b*c*x + I*b^2)/ c))*sin(1/4*(b^2 + 4*a*c)/c))*sqrt((4*c^2*x^2 - 4*b*c*x + b^2)/c))/(c^2*sq rt((4*c^2*x^2 - 4*b*c*x + b^2)/c))
Result contains complex when optimal does not.
Time = 0.37 (sec) , antiderivative size = 185, normalized size of antiderivative = 1.49 \[ \int x \cos \left (a+b x-c x^2\right ) \, dx=-\frac {-\frac {i \, \sqrt {2} \sqrt {\pi } b \operatorname {erf}\left (-\frac {1}{4} i \, \sqrt {2} {\left (2 \, x - \frac {b}{c}\right )} {\left (\frac {i \, c}{{\left | c \right |}} + 1\right )} \sqrt {{\left | c \right |}}\right ) e^{\left (-\frac {i \, b^{2} + 4 i \, a c}{4 \, c}\right )}}{{\left (\frac {i \, c}{{\left | c \right |}} + 1\right )} \sqrt {{\left | c \right |}}} + 2 i \, e^{\left (i \, c x^{2} - i \, b x - i \, a\right )}}{8 \, c} - \frac {\frac {i \, \sqrt {2} \sqrt {\pi } b \operatorname {erf}\left (\frac {1}{4} i \, \sqrt {2} {\left (2 \, x - \frac {b}{c}\right )} {\left (-\frac {i \, c}{{\left | c \right |}} + 1\right )} \sqrt {{\left | c \right |}}\right ) e^{\left (-\frac {-i \, b^{2} - 4 i \, a c}{4 \, c}\right )}}{{\left (-\frac {i \, c}{{\left | c \right |}} + 1\right )} \sqrt {{\left | c \right |}}} - 2 i \, e^{\left (-i \, c x^{2} + i \, b x + i \, a\right )}}{8 \, c} \]
-1/8*(-I*sqrt(2)*sqrt(pi)*b*erf(-1/4*I*sqrt(2)*(2*x - b/c)*(I*c/abs(c) + 1 )*sqrt(abs(c)))*e^(-1/4*(I*b^2 + 4*I*a*c)/c)/((I*c/abs(c) + 1)*sqrt(abs(c) )) + 2*I*e^(I*c*x^2 - I*b*x - I*a))/c - 1/8*(I*sqrt(2)*sqrt(pi)*b*erf(1/4* I*sqrt(2)*(2*x - b/c)*(-I*c/abs(c) + 1)*sqrt(abs(c)))*e^(-1/4*(-I*b^2 - 4* I*a*c)/c)/((-I*c/abs(c) + 1)*sqrt(abs(c))) - 2*I*e^(-I*c*x^2 + I*b*x + I*a ))/c
Timed out. \[ \int x \cos \left (a+b x-c x^2\right ) \, dx=\int x\,\cos \left (-c\,x^2+b\,x+a\right ) \,d x \]